import { dataSourceType } from '@/type.d';
import { defineStore } from 'pinia';
// import { generatorDynamicRouter } from '@/router/generator-router';
// import type { RouteRecordRaw } from 'vue-router';
// import { resetRouter } from '@/router';


export const useModelStore = defineStore({
  id: 'columnModel',
  persist: {
    enabled: true,//开启数据持久化
    strategies: [
      {
        key: 'columnModel',//给一个要保存的名称
        storage: sessionStorage,//sessionStorage / localStorage 存储方式
      },
    ]
  },
  state: (): dataSourceType => ({
    column_modelData: {}
  }),
  actions: {
    /** 登录成功保存token */
    setData(state: dataSourceType) {
      this.column_modelData[state.param] = state.value
      return this.column_modelData
    },
  },
});

